package textmining.gpanalysis.stemming;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.snowball.SnowballAnalyzer;
import org.apache.lucene.util.Version;

/**
 *
 * @author ibrahimsabek
 */
public class SnowballStemSnippet {

    FileReader fileReader;

    public SnowballStemSnippet() throws FileNotFoundException{
       fileReader = new FileReader("txtInput/text1.txt");
    }

        public void stemm(){
        try {

            Version ver = new Version("verName",1);
            Analyzer stemAnalyzer = new SnowballAnalyzer(ver, "English");
            TokenStream tStream = stemAnalyzer.tokenStream("snowballStemField", fileReader);
            Token t = tStream.next();

            while(t != null){
                System.out.println("token: "+t+ "type: "+t.type());
                t = tStream.next(t);
            }

        } catch (IOException ex) {
            System.out.println(ex.getMessage());
            Logger.getLogger(PorterStemSnippet.class.getName()).log(Level.SEVERE, null, ex);
        }



    }

}
